package com.itheima.employee.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.itheima.employee.mapper.UserCompanyJobsMapper;
import com.itheima.employee.pojo.UserCompanyJobs;
import com.itheima.employee.service.UserCompanyJobsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author qiankaofei
 * @version 1.0
 * @date 2020/11/16 10:45
 */
@Service
@Transactional
public class UserCompanyJobsServiceImpl implements UserCompanyJobsService {

    @Autowired
    private UserCompanyJobsMapper userCompanyJobsMapper;

    /**
     * 员工岗位信息保存
     */
    @Override
    public Integer save(UserCompanyJobs jobsInfo) {
        return userCompanyJobsMapper.insert(jobsInfo);
    }

    /**
     * 员工岗位信息读取（根据userId读取）
     */
    @Override
    public UserCompanyJobs findById(String userId) {
        QueryWrapper<UserCompanyJobs> wrapper=new QueryWrapper<UserCompanyJobs>();
        wrapper.eq("user_id",userId);
        return userCompanyJobsMapper.selectOne(wrapper);
    }
}
